package com.ls.controller;


import com.ls.base.BaseResult;
import com.ls.controller.model.serviceChannel.AddServiceChannelModel;
import com.ls.controller.model.serviceChannel.QueryServiceChannelModel;
import com.ls.controller.model.serviceChannel.UpDownServiceChannelModel;
import com.ls.entity.SysUser;
import com.ls.service.ICommServiceChannelService;
import com.ls.utils.login.CurrentUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 *  业务与通道关联
 * </p>
 * @author pengyu
 * @since 2019-12-05
 */
@Api(value = "通道与业务关联相关接口", description = "通道与业务关联相关接口")
@Controller
@RequestMapping("/commServiceChannel")
public class CommServiceChannelController {

    @Autowired
    ICommServiceChannelService service;

    /**
     * 新增
     */
    @ApiOperation(value = "新增,默认优先级最低")
    @PostMapping(value = "add")
    @ResponseBody
    public BaseResult add(@Valid @RequestBody AddServiceChannelModel model, @CurrentUser SysUser currentUser) {
        return service.add(model, currentUser);
    }

    /**
     * 查询列表
     */
    @ApiOperation(value = "查询分页列表")
    @GetMapping(value = "listByPage")
    @ResponseBody
    public BaseResult listByPage(QueryServiceChannelModel model, @CurrentUser SysUser currentUser) {
        return service.listByPage(model, currentUser);
    }

    /**
     * 调整排序
     */
    @ApiOperation(value = "调整排序")
    @PostMapping(value = "upDown")
    @ResponseBody
    public BaseResult upDown(@Valid @RequestBody UpDownServiceChannelModel model, @CurrentUser SysUser currentUser) {
        return service.upDown(model, currentUser);
    }


}

